<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
	<!-- imports -->
	<script language="JavaScript" src="../js/FrageHinzufuegen.js"></script>
	<!-- imports -->
		<center><h:outputLabel value="Frage hinzufügen" styleClass="ueberschrift"/></center>
		<table id="frage_hinzufuegen_table" class="standart kontoverwaltung">
			<tr>
				<td>Frage:</td>
				<td><h:inputTextarea  cols="80" rows="7" value="#{FrageHinzufuegenViewBean.question}" maxlength="255" id="frage_text"/></td>
			</tr>
			<tr>
				<td>Fragetyp:</td>
				<td>
				<rich:select value="#{FrageHinzufuegenViewBean.questionTyp}" hideNoSelectionOption="true">
					<f:selectItems value="#{FrageHinzufuegenViewBean.questionTypeList}"/>
					<a4j:ajax event="selectitem" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();" render="main"/>
				</rich:select>
				</td>
			</tr>
			<tr>
				<td></td>
				<td><center>
					<rich:panel styleClass="newQuestionAnswerChoicePanel" rendered="#{FrageHinzufuegenViewBean.showAnswerChoice}">
						<center><rich:pickList value="#{FrageHinzufuegenViewBean.selectedAnswers}" sourceCaption="Available Answers" targetCaption="Selected Answers" listWidth="130px" listHeight="100px" orderable="false">
                			<f:selectItems value="#{FrageHinzufuegenViewBean.allAnswerPossibilities}" var="answer"  itemValue="#{answer}" itemLabel="#{answer.text}" />
           		 			<f:converter converterId="AnswerPossibilityConverter" />
           		 		</rich:pickList></center>
           		 		<hr width="80%" style="margin:5px;"/>
           		 		<a4j:commandButton value="neue Antwortmöglichkeit" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();#{rich:component('addAnswerPossibility')}.show();"/>
					</rich:panel></center>
				</td>
			</tr>
			<tr>
				<td colspan="2"><center><a4j:commandButton action="#{FrageHinzufuegenViewBean.createNewQuestion()}" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();" value="speichern" render="Messagespopup mainmenueform"/></center></td>
			</tr>
		</table>
		
		<rich:panel styleClass="newQuestionAnswerChoiceDetailPanel">
		<f:facet name="header">Detail</f:facet>
		<h:inputTextarea id="answerChoiceDetail" style="width: 100%;" readonly="true"/>
		</rich:panel>
		
		<rich:popupPanel id="addAnswerPossibility" autosized="true" domElementAttachment="parent">
			<f:facet name="header"><center>neue Antwortmöglichkeit</center></f:facet>
			<table id="Antwortmoeglichkeit_hinzufuegen_table" class="standart kontoverwaltung">
			<tr>
				<td>Antwortmöglichkeit:</td>
				<td><h:inputTextarea  cols="80" rows="7" value="#{FrageHinzufuegenViewBean.newAnswerPossibility}" maxlength="255"/></td>
			</tr>
			<tr>
				<td colspan="2">
				<center>
				<a4j:commandButton action="#{FrageHinzufuegenViewBean.createNewAnswerPossibility()}" oncomplete="#{rich:component('addAnswerPossibility')}.hide();" execute="mainmenueform" render="Messagespopup mainmenueform" value="speichern"/>
				<a4j:commandButton onclick="#{rich:component('addAnswerPossibility')}.hide();" value="abbrechen"/>
				</center></td>
			</tr>
			</table>
		</rich:popupPanel>														
</ui:composition>